package com.hopu.oa.service.impl.role;

import com.hopu.oa.dao.role.roleDao;
import com.hopu.oa.entity.user.AoaRole;
import com.hopu.oa.service.impl.menu.menuServiceImpl;
import com.hopu.oa.service.role.roleService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class roleServiceImpl implements roleService {

    @Autowired
    private roleDao roleDao;
    @Autowired
    private menuServiceImpl menuService;

    @Override
    public int insertRoleList(@Param("list") List<Integer> list, @Param("roleId") Integer roleId) {
        return roleDao.insertRoleList(list, roleId);
    }

    @Override
    public int updateRole(AoaRole aoaRole) {
        int i = roleDao.updateRole(aoaRole);
        return i;
    }

    @Override
    public AoaRole selectRoleByRoleId(Integer roleId) {
        return roleDao.selectRoleByRoleId(roleId);
    }

    @Override
    public AoaRole selectRoleByRoleName(String roleName) {
        return roleDao.selectRoleByRoleName(roleName);
    }


    @Override
    public List<AoaRole> selectAllRole(@Param("roleName") String roleName, @Param("index") Integer index, @Param("size") Integer size) {
        return roleDao.selectAllRole(roleName, index, size);
    }

    @Override
    public int deleteRoleAndRoleList(Integer roleId) {
        return roleDao.deleteRoleAndRoleList(roleId);
    }

    @Override
    public int isnertRole(AoaRole aoaRole) {
        return roleDao.isnertRole(aoaRole);
    }
}
